function [status]=addparammmat3d(name, var, ni,nj,nk,nr,nc,elist)
  %AddMetadata(name, property, port) 
  flag=7;
  nargin=length(elist);
  if nargin>0 then
    server=elist{1};
    if nargin>1 then
      port=elist{2};
      if nargin>2 then
         id=elist{3};
      else
         id=0;
      end 
    else
      port=8080;
    end
  else
    server='localhost';
    port=8080;
    id=0;
  end

   sport=sprintf('%d',port);
  obj.endpoint=['http://',server,':',sport];

  
  
    ind=1;
    for i1=1:ni
       for i2=1:nj
          for i3=1:nk
            for i=1:nr
              for j=1:nc
               vvar(ind)=var(i1,i2,i3,i,j);
               ind=ind+1;
              end
            end
        end
      end
    end
 

  sval=vectostring(vvar',',');
  
  scommand=['iogs addparam mmat3d ',name,' ',sval,' ',num2str(ind),' ',num2str(flag),' ',num2str(id),' ',sport,' ',server];
  display(scommand);
  system(scommand);
  
  %status=ioaddparammat3d(obj, id,name,vvar,ni,nj,nk,nr,nc,flag);

%endfunction


function status = ioaddparammmat3d(obj,id,name,value,n,p,q,nr,nc,iflag)
%addparammmat3d(obj,id,name,value,n,p,q,nr,nc,iflag)
%
%   Service definition of function ns__addparammmat3d
%   
%     Input:
%       id = (int)
%       name = (string)
%       value = (Array)
%       n = (int)
%       p = (int)
%       q = (int)
%       nr = (int)
%       nc = (int)
%       iflag = (int)
%   
%     Output:
%       status = (int)

% Build up the argument lists.
values = { ...
   id, ...
   name, ...
   value, ...
   n, ...
   p, ...
   q, ...
   nr, ...
   nc, ...
   iflag, ...
   };
names = { ...
   'id', ...
   'name', ...
   'value', ...
   'n', ...
   'p', ...
   'q', ...
   'nr', ...
   'nc', ...
   'iflag', ...
   };
types = { ...
   '{http://www.w3.org/2001/XMLSchema}int', ...
   '{http://www.w3.org/2001/XMLSchema}string', ...
   'Array', ...
   '{http://www.w3.org/2001/XMLSchema}int', ...
   '{http://www.w3.org/2001/XMLSchema}int', ...
   '{http://www.w3.org/2001/XMLSchema}int', ...
   '{http://www.w3.org/2001/XMLSchema}int', ...
   '{http://www.w3.org/2001/XMLSchema}int', ...
   '{http://www.w3.org/2001/XMLSchema}int', ...
   };

% Create the message, make the call, and convert the response into a variable.
soapMessage = createSoapMessage( ...
    'urn:IoSteerWS', ...
    'addparammmat3d', ...
    values,names,types,'rpc');
response = callSoapService( ...
    obj.endpoint, ...
    '', ...
    soapMessage);
status = parseSoapResponse(response);
